package com.br.pfm.persistence.model;

import java.io.Serializable;
import java.util.GregorianCalendar;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import lombok.Getter;
import lombok.Setter;

@Entity
@Table(name="PFM_fatura")
public class Fatura implements Serializable {
	
	private static final long serialVersionUID = 9060605303391551597L;
	
	@Id
	@GeneratedValue
	@Column(name = "id_fatura", nullable = false, length = 2)
	private int idFatura;
	
	@Getter
    @Setter
	@Column(name = "valor_fatura", nullable = false, length = 10)
	private int valorFatura;
	
	@Getter
    @Setter
	@Column(name = "dt_vencimento", nullable = false, length = 10)
	public GregorianCalendar dataVencimento;
	
	@Getter
    @Setter
	@Column(name = "id_fatura_anterior", nullable = false, length = 2)
	private int idFaturaAnterior;
	
	@Getter
    @Setter
	@Column(name = "status_fatura", nullable = false, length = 1)
	private char statusFatura;
	
	@Getter
    @Setter
	@ManyToOne(cascade=CascadeType.ALL)
    private Instituicao instituicao;
	
	@Getter
	@Setter
	@OneToMany(cascade=CascadeType.ALL)
    @JoinColumn(name="id_fatura")
    private List<ItemFatura> itensFatura;
	
	@Getter
	@Setter
	@OneToMany(cascade=CascadeType.ALL)
    @JoinColumn(name="id_fatura")
    private List<Pagamento> pagamentos;

}
